import {
  LocalizationContext,
  MinimalButton,
  Position,
  Tooltip,
} from "../../core";

import { RenderEnterFullScreenProps } from "./EnterFullScreen";
import FullScreenIcon from "./FullScreenIcon";
import { FC, useContext } from "react";

const TOOLTIP_OFFSET = { left: 0, top: 8 };

const EnterFullScreenButton: FC<RenderEnterFullScreenProps> = ({ onClick }) => {
  const l10n = useContext(LocalizationContext);

  const label =
    l10n && l10n.fullScreen ? l10n.fullScreen.enterFullScreen : "Full screen";

  return (
    <Tooltip
      position={Position.BottomCenter}
      target={
        <MinimalButton onClick={onClick}>
          <FullScreenIcon />
        </MinimalButton>
      }
      content={() => label}
      offset={TOOLTIP_OFFSET}
    />
  );
};

export default EnterFullScreenButton;
